import json
from od_config import *
from InterfaceSpecification import http_port
from flask import Flask, request, jsonify, make_response


app = Flask(__name__)
http_object = http_port()


@app.route(rule=TG_URL, methods=['POST'])
def http_data():
    data = json.loads(request.get_data(as_text=True))  # 获取后端传入的数据
    return_result = http_object.get_result(data)
    response = make_response(jsonify(return_result))
    return response

if __name__ == '__main__':
    app.config['JSON_AS_ASCII'] = False
    app.config['JSON_SORT_KEYS'] = False
    app.run(host=HOST, port=PORT, debug=False, use_reloader=False)
